package com.aote.reportforms;

import java.util.Hashtable;

import com.browsesoft.dbtools.DBTools;

/**
 * 报表实体
 * 
 */
public class Reportforms {

	/**
	 * id
	 */
	private String id = "";

	/**
	 * 表名
	 */
	private String tableName = "";

	/**
	 * 属性
	 */
	private Hashtable attributes = new Hashtable();

	public Reportforms(String id, String tableName, Hashtable attrs) {
		this.id = id;
		this.tableName = tableName;
		this.attributes = attrs;
	}

	public void insert() {
		try {
			this.attributes.put("id", this.id);
			DBTools.insert(this.tableName, this.attributes);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}

	public void update() {
		try {
			DBTools.update(this.tableName, this.id, this.attributes);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}

	public void delete() {
		try {
			DBTools.delete(this.tableName, this.id);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}

	public Hashtable getAttributes() {
		return this.attributes;
	}
}
